<?php

namespace app\common\model\card;

use think\Model;


class Transferlog extends Model
{

    

    

    // 表名
    protected $name = 'card_entity_transferlog';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'transfer_data_text'
    ];
    

    
    public function getTransferDataList()
    {
        return ['0' => __('Transfer_data 0'), '1' => __('Transfer_data 1'), '2' => __('Transfer_data 2')];
    }


    public function getTransferDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['transfer_data']) ? $data['transfer_data'] : '');
        $list = $this->getTransferDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function dealer()
    {
        return $this->belongsTo('Dealer', 'card_dealer_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
    public function cardEntity()
    {
        return $this->belongsTo('app\common\model\card\Entity', 'card_entity_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
